﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YBApproval.Model;

namespace YBApproval.IDAL
{
    public interface IInstanceApproval : IDisposable
    {
        InstanceApproval GetInstanceApproval(int id);

        List<InstanceApproval> GetInstanceApprovals(string instanceId);

        int GetApprovalAmountByStep(string instanceId, int step);

        int GetNotDenyAmountByStep(string instanceId, int step);

        /// <summary>
        /// Get instance approvals for next node(step)
        /// </summary>
        /// <param name="formId"></param>
        /// <param name="nodeOrderId"></param>
        /// <returns></returns>
        List<InstanceApproval> GetInstanceApprovals(int formId, int nodeOrderId);

        void SaveInstanceApproval(InstanceApproval ia);

        void SaveInstanceApprovals(List<InstanceApproval> iaList);

        int GetCurrentStep(string instanceId);

        //void DeleteInstanceApprovals(Guid instanceId);

        List<InstanceApproval> GetInstanceApprovalsForLastStep(string instanceId, int step);

        /// <summary>
        /// 取得当前待处理事项：包括需要我审批的、或我发起的被退回的流程
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        List<InstanceApproval> GetWorkItems(int userId);

        //所有我审批过的流程
        List<InstanceApproval> GetApprovedItems(int userId, string recordId = "", int? submitterId = null, string processName = "", DateTime? dtStart = null, DateTime? dtEnd = null);

        //我提交的未完成的流程
        List<InstanceApproval> GetOpenItems(int userId);

        //所有我发起的流程
        List<InstanceApproval> GetRequestItems(int userId, string recordId = "", int? submitterId = null, string processName = "", DateTime? submitDtStart = null, DateTime? submitDtEnd = null, DateTime? closeDtStart = null, DateTime? closeDtEnd = null);

        //我的草稿流程
        List<Instance> GetDraftItems(int userId);
    }
}
